
package com.itheima.crm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itheima.common.utils.Page;

import com.itheima.crm.mapper.MeetingDao;
import com.itheima.crm.pojo.Application;
import com.itheima.crm.pojo.Meeting;
import com.itheima.crm.service.MeetingService;

/**
 * 会议管理
 * 
 * @author lx
 *
 */
@Service
public class MeetingServiceImpl implements MeetingService {

	@Autowired
	private MeetingDao Meetingdao;


	@Override
	public Page<Meeting> selectMeetingList(Meeting vo) {
		Page<Meeting> page = new Page<Meeting>();
		// 每页数
		page.setSize(5);
		vo.setSize(5);
		if (null != vo) {
			// 判断当前页
			if (null != vo.getPage()) {
				page.setPage(vo.getPage());
				vo.setStartRow((vo.getPage() - 1) * vo.getSize());
			}

			// 总条数
			page.setTotal(Meetingdao.MeetingCount(vo));

			page.setRows(Meetingdao.selectMeetingList(vo));
		}
		return page;
	}

	@Override
	public Meeting selectMeetingById(Integer id) {
		return Meetingdao.selectMeetingById(id);

	}

	@Override
	public void insertMeeting(Meeting meeting,Application application) {
		Meetingdao.newMeeting(meeting,application);

	}

	@Override
	public void deleteMeeting(Integer id) {
		Meetingdao.deleteMeeting(id);

	}

	@Override
	public void updateMeetingById(Meeting meeting) {
		Meetingdao.updateMeetingById(meeting);
		
	}

	@Override
	public void joinpeople(String joinpeople, Integer id) {
		Meetingdao.joinpeople(joinpeople, id);
		
	}

}
